'use strict'

const Controller = require('egg').Controller

class ArchiveController extends Controller {
  async getArchiveList() {
    const { ctx } = this
    const resBody = await this.service.managerrecord.archive.getArchiveList(
      ctx.query
    )
    ctx.body = resBody
  }
  async getSingleArchive() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.archive.getSingleArchive({
      archive_name: ctx.params.option,
    })
    ctx.body = resBody
  }
  async createArchive() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.archive.createArchive(
      ctx.request.body
    )
    ctx.body = resBody
  }
  async updateArchive() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.archive.updateArchive(
      ctx.request.body,
      ctx.params.id
    )
    ctx.body = resBody
  }
  async deleteArchive() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.archive.deleteArchive(
      ctx.params.id
    )
    ctx.body = resBody
  }
  async uploadFiles() {
    const { ctx } = this
    const resBody = await ctx.service.managerrecord.archive.uploadFiles()
    ctx.body = resBody
  }
}

module.exports = ArchiveController
